//Page Object
Page({
  data: {
    navList: [],
    currentIndexNav: 0,
    swiperList: [],
    videoList: [],
  },
  activeNav (e) {
    this.setData({
      currentIndexNav: e.target.dataset.index
    })
  },
  // 获取导航栏的数据
  getNavList () {
    let that = this
    wx.request({
      url: 'https://mockapi.eolinker.com/7b7NMB9c75d613bc39c8f16e4e03a3d4a8f951750079dc5/navList',
      success (res) {
        if (res.data.code === 0) {
          that.setData({
            navList: res.data.data.navList
          })
        }
      }
    })
  },
  // 获取轮播图的数据
  getSwiperList () {
    let that = this
    wx.request({
      url: 'http://mock-api.com/mnEe4VnJ.mock/swiperList',
      success (res) {
        if (res.data.code === 0) {
          // console.log(res);
          that.setData({
            swiperList: res.data.data.swiperList
          })
        }
      }
    })
  },
  // 获取视频的数据
  getVideoList () {
    let that = this
    wx.request({
      url: 'http://mock-api.com/mnEe4VnJ.mock/videoList',
      success (res) {
        // console.log(res);
        if (res.data.code === 0) {
          that.setData({
            videoList: res.data.data.videoList
          })
        }
      }
    })
  },
  //options(Object)
  onLoad: function (options) {
    this.getNavList()
    this.getSwiperList()
    this.getVideoList()
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  },
  onPageScroll: function () {

  },
  //item(index,pagePath,text)
  onTabItemTap: function (item) {

  }
});
